/*
 * @(#)CategoryReader.java $version 2012. 8. 28.
 *
 * Copyright 2007 NHN Corp. All rights Reserved. 
 * NHN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

package com.batch;

import java.util.HashMap;
import java.util.Map;

import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.NonTransientResourceException;
import org.springframework.batch.item.ParseException;
import org.springframework.batch.item.UnexpectedInputException;

/**
 * @author hs
 */
public class CategoryReader implements ItemReader<Map<String, String>> {
	private static int count = 1;

	/**
	 * @return
	 * @throws Exception
	 * @throws UnexpectedInputException
	 * @throws ParseException
	 * @throws NonTransientResourceException
	 * @see org.springframework.batch.item.ItemReader#read()
	 */
	public Map<String, String> read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException {
		System.err.println("TEST SUCCESS.");
		Map<String, String> result = new HashMap<String, String>();
		result.put("user_nm", "category1");
		count++;

		if (count > 2) {
			result = null;
		}

		return result;
	}

}
